{% set menus = request.state.template_data.menus %}
{% if menus %}
    <ul id="gnb_1dul">
    {% for menu in menus %}
        {% set is_submenu = True if menu.sub|count > 0 else False %}
        <li class="gnb_1dli">
            <a href="{{ menu.me_link }}" target="_{{ menu.me_target }}" class="gnb_1da">{{ menu.me_name }}</a>
            {% if is_submenu %}
            <button type="button" class="btn_gnb_op"><span class="blind">子分类</span></button>
            <ul class="gnb_2dul">
                {% for sub in menu.sub %}
                <li class="gnb_2dli">
                    <a href="{{ sub.me_link }}" target="_{{ sub.me_target }}" class="gnb_2da"><span></span>{{ sub.me_name }}</a>
                </li>
                {% endfor %}
            </ul>
            {% endif %}
        </li>
    {% else %}
        <li id="gnb_empty">
            正在准备菜单. <br>
            <a href="/admin/menu_list">管理器模式 &gt; 环境设置 &gt; 菜单设置</a>设置在.
        </li>
    {% endfor %}
    </ul>
{% endif %}

<script>
$(".btn_gnb_op").click(function(){
    $(this).toggleClass("btn_gnb_cl").next(".gnb_2dul").slideToggle(300);
});
</script>